package com.example.common.exception;


import lombok.Data;

/**
 * 服务异常，可用于控制业务异常流程，抛出后由统一异常增强类捕获，返回友好提示
 *
 * @author Jensen
 * @公众号 架构师修行录
 */
@Data
public class ServiceException extends RuntimeException {
    protected Integer code;
    public ServiceException(Integer code, String message) {
        super(message);
        this.code = code;
    }
    public ServiceException() {
        this(500, "请求成功但是服务异常");
    }
    public ServiceException(String message) {
        this(500, message);
    }
    public ServiceException(Throwable e) {
        this(e.getMessage());
    }
}
